package com.itcast.peft.entity.report;

import lombok.Data;

/**
 * 风险分布类
 * @author itheima
 */
@Data
public class RiskDistributionVo {
    /**
     * 健康
     */
    private double healthy;
    /**
     * 警告
     */
    private double caution;
    /**
     * 风险
     */
    private double risk;
    /**
     * 危险
     */
    private double danger;
    /**
     * 严重危险
     */
    private double severeDanger;
    
    public int accuracyScore(RiskDistributionVo ref) {
        // 累积5项误差
        int total = 0;
        total += Math.abs(healthy - ref.healthy);
        total += Math.abs(caution - ref.caution);
        total += Math.abs(risk - ref.risk);
        total += Math.abs(danger - ref.danger);
        total += Math.abs(severeDanger - ref.severeDanger);
        return total <= 50 ? 1 : 0;
    }

}